<template>
  <el-pagination
    background
    layout="total, sizes, prev, pager, next"
    :total="paginationObject.total"
    :page-size="paginationObject.pageSize"
    :current-page="paginationObject.pageNum"
    :page-sizes="[3, 5, 10, 30]"
    @current-change="currentChange"
    @size-change="sizeChange"
  >
  </el-pagination>
</template>

<script>
export default {
  props: ["paginationMethod", "paginationObject"],
  methods: {
    currentChange(pageNum) {
      this.paginationMethod({
        page: pageNum,
        size: this.currentPageSize,
      });
    },
    sizeChange(pageSize) {
      this.currentPageSize = pageSize;
      this.paginationMethod({
        page: 1,
        size: pageSize,
      });
    },
  },
  data() {
    return {
      currentPageSize: 30,
    };
  },
};
</script>

<style></style>
